home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8730 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem Negating an Unsigned Char
  5. Date: Tue, 05 Mar 96 23:12:14 GMT
  6. Organization: none
  7. Message-ID: <826067534snz@genesis.demon.co.uk>
  8. References: <Dnnros.Lq.0.-s@hkusuc.hku.hk> <TANMOY.96Mar2222131@qcd.lanl.gov>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <TANMOY.96Mar2222131@qcd.lanl.gov>
  15.            tanmoy@qcd.lanl.gov "Tanmoy Bhattacharya" writes:
  16.  
  17. >The problem is that before the application of almost any arithmetic or
  18. >bit manipulation operators, `integral promotions' take place. These
  19. >change char and signed and unsigned char and short to either int ot
  20. >unsigned int (depending on how big they are).
  21.  
  22. To be 100% clear 'they' refers to the types rather than the values they
  23. happen to hold at the time and is always determinable at compile time.
  24. So if UCHAR_MAX is less than or equal to INT_MAX then unsigned chars promote
  25. to ints, otherwise they promote to unsigned ints.
  26.  
  27. -- 
  28. -----------------------------------------
  29. Lawrence Kirby | fred@genesis.demon.co.uk
  30. Wilts, England | 70734.126@compuserve.com
  31. -----------------------------------------
  32.